package com.sciencep.pro.common.domain;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
public enum FileTypeEnum {
    /**
     * zip格式压缩包
     */
    FILE_TYPE_ZIP("application/zip", ".zip"),
    /**
     * rar格式压缩包
     */
    FILE_TYPE_RAR("application/octet-stream", ".rar");
    private String type;
    private String suffix;

    public static String getFileSuffix(String type) {
        for (FileTypeEnum orderTypeEnum : FileTypeEnum.values()) {
            if (orderTypeEnum.type.equals(type)) {
                return orderTypeEnum.suffix;
            }
        }
        return null;
    }
}
